const Router = require("@koa/router");
const router = new Router({ prefix: "/api/v1" }); //设置路由前缀
const userController = require("../controller/userController");
const { userValidate } = require("../middleware/userValidate");
const { loginValidate } = require("../middleware/loginValidate");
const { verifyToken } = require("../utils/jwt");

// router.get("/user/:id",userController.getUser);
router.post("/user/register", userValidate, userController.register); //注册用户
router.post("/user/login", loginValidate, userController.login); //登录用户
router.get("/user/getUser/:userId", verifyToken(false), userController.getUser); //获取用户 token校验
router.get("/user/subscribe/:subscribeId", verifyToken(true), userController.subscribe); //获取用户 token校验
router.get("/user/subscribeList", verifyToken(true), userController.subscribeList); //获取用户 token校验

module.exports = router;
